home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / g / gnu_c / pmlsrc23.zoo / pmlsrc / pml.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-19  |  4.4 KB  |  157 lines

  1. /************************************************************************
  2.  *                                    *
  3.  *                N O T I C E                *
  4.  *                                    *
  5.  *            Copyright Abandoned, 1987, Fred Fish        *
  6.  *                                    *
  7.  *    This previously copyrighted work has been placed into the    *
  8.  *    public domain by the author (Fred Fish) and may be freely used    *
  9.  *    for any purpose, private or commercial.  I would appreciate    *
  10.  *    it, as a courtesy, if this notice is left in all copies and    *
  11.  *    derivative works.  Thank you, and enjoy...            *
  12.  *                                    *
  13.  *    The author makes no warranty of any kind with respect to this    *
  14.  *    product and explicitly disclaims any implied warranties of    *
  15.  *    merchantability or fitness for any particular purpose.        *
  16.  *                                    *
  17.  ************************************************************************
  18.  */
  19.  
  20.  
  21. /*
  22.  *    This file gets included with all of the floating point math
  23.  *    library routines when they are compiled.  Note that
  24.  *    this is the proper place to put machine dependencies
  25.  *    whenever possible.
  26.  *
  27.  *    It should be pointed out that for simplicity's sake, the
  28.  *    environment parameters are defined as floating point constants,
  29.  *    rather than octal or hexadecimal initializations of allocated
  30.  *    storage areas.  This means that the range of allowed numbers
  31.  *    may not exactly match the hardware's capabilities.  For example,
  32.  *    if the maximum positive double precision floating point number
  33.  *    is EXACTLY 1.11...E100 and the constant "MAXDOUBLE is
  34.  *    defined to be 1.11E100 then the numbers between 1.11E100 and
  35.  *    1.11...E100 are considered to be undefined.  For most
  36.  *    applications, this will cause no problems.
  37.  *
  38.  *    An alternate method is to allocate a global static "double" variable,
  39.  *    say "maxdouble", and use a union declaration and initialization
  40.  *    to initialize it with the proper bits for the EXACT maximum value.
  41.  *    This was not done because the only compilers available to the
  42.  *    author did not fully support union initialization features.
  43.  *
  44.  */
  45.  
  46. #ifndef _PML_H
  47. #define _PML_H
  48.  
  49. #ifndef NO_DBUG
  50. # define NO_DBUG
  51. #endif NO_DBUG
  52.  
  53. #ifndef NO_DBUG
  54. #    include <dbug.h>
  55. #else
  56. #    define DBUG_ENTER(a1)
  57. #    define DBUG_RETURN(a1) return(a1)
  58. #    define DBUG_VOID_RETURN return
  59. #    define DBUG_EXECUTE(keyword,a1)
  60. #    define DBUG_2(keyword,format)
  61. #    define DBUG_3(keyword,format,a1)
  62. #    define DBUG_4(keyword,format,a1,a2)
  63. #    define DBUG_5(keyword,format,a1,a2,a3)
  64. #    define DBUG_PUSH(a1)
  65. #    define DBUG_POP()
  66. #    define DBUG_PROCESS(a1)
  67. #    define DBUG_FILE (stderr)
  68. #    define ENTER(a1)
  69. #    define LEAVE()
  70. #    define DEBUG3(keyword,format,a1)
  71. #    define DEBUG4(keyword,format,a1,a2)
  72. #    define DEBUGPUSH(a)
  73. #    define DEBUGWHO(w)
  74. #endif
  75.  
  76. #include <errno.h>
  77. extern int errno;
  78.  
  79. #ifndef atarist
  80. #ifdef ATARI_ST
  81. #include <std.h>
  82. #endif
  83. #endif
  84. /*
  85.  *    MAXDOUBLE    =>    Maximum double precision number
  86.  *    MINDOUBLE    =>    Minimum double precision number
  87.  *    DMAXEXP        =>    Maximum exponent of a double
  88.  *    DMINEXP        =>    Minimum exponent of a double
  89.  */
  90.  
  91. #define MAXDOUBLE    1.7e+308
  92. #define MINDOUBLE    2.225e-308
  93. #define DMAXEXP        1023
  94. #define DMINEXP        (-1022)
  95.  
  96. #define LOG2_MAXDOUBLE 1024
  97. #define LOG2_MINDOUBLE (-1023)
  98. #define LOGE_MAXDOUBLE  7.09782712893383970e+02
  99. #define LOGE_MINDOUBLE  -7.09089565712824080e+02
  100.  
  101. /*
  102.  *    The following are hacks which should be fixed when I understand all
  103.  *    the issues a little better.   |tanh(TANH_MAXARG)| = 1.0
  104.  */
  105. #define TANH_MAXARG 16
  106. #define SQRT_MAXDOUBLE 1.304380e19
  107.  
  108. #define PI        3.14159265358979323846
  109. #define TWOPI         6.28318530717958620
  110. #define HALFPI        1.57079632679489660
  111. #define FOURTHPI    0.785398163397448280
  112. #define SIXTHPI        0.523598775598298820
  113.  
  114. #define LOG2E        1.4426950408889634074    /* Log to base 2 of e */
  115. #define LOG10E        0.4342944819032518276
  116. #define SQRT2        1.41421356237309504880
  117. #define SQRT3        1.7320508075688772935
  118. #define LN2        0.69314718055994530942
  119. #define LNSQRT2        0.3465735902799726547
  120.  
  121.  
  122. /*
  123.  *    MC68000 HARDWARE DEPENDENCIES
  124.  *
  125.  *        cc -DIEEE    =>    uses IEEE floating point format
  126.  *
  127.  */
  128.  
  129. #ifdef IEEE
  130. #define X6_UNDERFLOWS (4.209340e-52)    /* X**6 almost underflows */
  131. #define X16_UNDERFLOWS (5.421010e-20)    /* X**16 almost underflows    */
  132. #endif
  133.  
  134. #ifdef TRUE
  135. #undef TRUE
  136. #endif
  137.  
  138. #ifdef FALSE
  139. #undef FALSE
  140. #endif
  141.  
  142. #define TRUE 1
  143. #define FALSE 0
  144. #define VOID void
  145.  
  146. #ifndef _COMPILER_H
  147. #include <compiler.h>
  148. #endif
  149.  
  150. __EXTERN double modf    __PROTO((double, double *));
  151. __EXTERN double ldexp    __PROTO((double, int));
  152. __EXTERN double frexp    __PROTO((double, int *));
  153. __EXTERN double poly    __PROTO((int, double *, double));
  154. __EXTERN double copysign __PROTO((double, double));
  155.  
  156. #endif /* _PML_H */
  157.